package com.mxpio.erp.plm.controller;

import com.mxpio.erp.common.plm.entity.*;
import com.mxpio.erp.common.plm.service.ProjectTaskCompleteService;
import com.mxpioframework.common.vo.Result;
import com.mxpioframework.jpa.JpaUtil;
import com.mxpioframework.jpa.query.Criteria;
import com.mxpioframework.jpa.query.Operator;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "ProjectTaskCompleteController", description = "项目任务完工-工作流")
@RestController
@RequestMapping("/erp/plm/pro/task/complete/")
public class ProjectTaskCompleteController {

    @Autowired
    private ProjectTaskCompleteService taskCompleteService;
    @PutMapping("edit")
    @Operation(summary = "编辑信息", description = "编辑信息", method = "PUT")
    public Result<ProjectTaskComplete> edit(@RequestBody ProjectTaskComplete complete) {
        taskCompleteService.update(complete);
        return Result.OK(complete);
    }

    @GetMapping("getById/{taskCode}")
    @Operation(summary = "根据完工申请单号-获取申请单", description = "根据完工申请单号-获取申请单", method = "GET")
    public Result<?> getById(@PathVariable(name = "taskCode", required = true) String taskCode) {
        return taskCompleteService.find(taskCode);

//        ProjectTaskComplete one = JpaUtil.linq(ProjectTaskComplete.class).equal("taskCode", taskCode).findOne();
//        ProjectTaskComplete complete = taskCompleteService.getById(ProjectTaskComplete.class, bizNo);
    }
}
